
package com.cptravel.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.core.controller.B5MBaseAdapter;
import com.core.util.B5MBitmapHelper;
import com.core.util.B5MDisplayHelper;
import com.cptravel.R;
import com.cptravel.bean.Class;

import java.util.List;

public class ExploreAdapter extends B5MBaseAdapter<Class>
{
    public ExploreAdapter(Activity activity, List<Class> mList)
    {
        super(activity, mList);
        // TODO Auto-generated constructor stub
    }

    @Override
    public View getView(int position , View convertView , ViewGroup parent , ViewHolder viewHolder)
    {
        // TODO Auto-generated method stub
        Class class1 = list.get(position);
        ImageView iv_pic = viewHolder.obtainView(convertView, R.id.iv_pic);
        ViewGroup.LayoutParams layoutParams = iv_pic.getLayoutParams();
        layoutParams.height = B5MDisplayHelper.getScreenWidth()/4;
        iv_pic.setLayoutParams(layoutParams);
        TextView tv_title = viewHolder.obtainView(convertView, R.id.tv_title);
        B5MBitmapHelper.displayDefaultNotPeopleRoundImage(class1.thum_img, iv_pic);
        tv_title.setText(class1.title);
        return convertView;
    }

    @Override
    public int itemLayoutRes()
    {
        // TODO Auto-generated method stub
        return R.layout.explore_item;
    }
}
